export const statusMap = {
    0: { text: '停用', status: 'error' },
    1: { text: '正常', status: 'processing' },
};

export const carerTypeMap = {
    0: '普陪',
    1: '产陪'
}

export function recursionMapTree(source = [], level = 1, last = 3) {
    const result = [];
    if (source.length > 0) {
        source.forEach(item => {
            item.level = level;
            item.value = item.id;
            item.label = item.name;
            if (Array.isArray(item.children) && item.children.length > 0) {
                item.children = recursionMapTree(item.children, level + 1, last);
                result.push(item);
            } else {
                if (level == last) {
                    delete item.children;
                    result.push(item);
                }
            }
        });
    }
    return result;
}
